package com.qfdu.repo.common;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;

public class StreamUtils {
    public static String readStreamData(InputStream inputStream) {
        BufferedInputStream bufferStream = new BufferedInputStream(inputStream);
        byte[] buffer = new byte[1024];
        int length = 0;
        StringBuilder builder = new StringBuilder();
        try {
            while ((length = bufferStream.read(buffer)) != -1) {
                builder.append(new String(buffer, 0, length));
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return builder.toString();
    }
}
